function gxvdate( Elem, nDateLen, nDateFmt, nTimeLen, nTimeFmt, sIdiom, pMandatoryCentury)
{
	var bMandatoryCentury = pMandatoryCentury || false;	
	var reEmpty = /^([ ]*(\/[ ]*\/[ ]*((00|12)(:00(:00)?)?[ ]*(a|am)?)?)?)?[ ]*$/i;
	var reVDTime;

	if (reEmpty.test( Elem.value))
	{
		Elem.value = "";
	}

	var sVDTime = "^[ ]*(";
	if (nDateLen > 0)
	{
		if (nDateLen == 8)
			sVDTime = sVDTime + "([0-9]{1,2})[\/]?([0-9]{1,2})[\/]?([0-9]{2})";
		else
		{
			if (nDateFmt == 0)
			{
				if (bMandatoryCentury)
					sVDTime = sVDTime + "([0-9]{1,2})[\/]?([0-9]{1,2})[\/]?([0-9]{4})";
				else
					sVDTime = sVDTime + "([0-9]{1,2})[\/]?([0-9]{1,2})[\/]?([0-9]{2,4})";
			}
			else
			{
				if (bMandatoryCentury)
					sVDTime = sVDTime + "([0-9]{4})[\/]?([0-9]{1,2})[\/]?([0-9]{1,2})";
				else
					sVDTime = sVDTime + "([0-9]{2,4})[\/]?([0-9]{1,2})[\/]?([0-9]{1,2})";
			}					
		}
	}
	else
		/* Extra parenthesis are added to maintain parameter numbers */
		sVDTime = sVDTime + "( )?( )?( )?";

	if (nTimeLen > 0)
	{
		sVDTime = sVDTime + "(";
		if (nDateLen > 0)
			sVDTime = sVDTime + "[ ]*";
		sVDTime = sVDTime + "([0-9]{2})";

		if (nTimeLen > 2)
			sVDTime = sVDTime + "(:?([0-9]{2}))?";
		else
			sVDTime = sVDTime + "(( )?)?";

		if (nTimeLen > 5)
			sVDTime = sVDTime + "(:?([0-9]{2}))?";
		else
			sVDTime = sVDTime + "(( )?)?";

		if ( nTimeFmt == 1)
			sVDTime = sVDTime + "[ ]*(a|am|p|pm)?";
		else
			sVDTime = sVDTime + "(( )?)?";

		sVDTime = sVDTime + ")?";
	}
	sVDTime = sVDTime + ")?[ ]*$";
	reVDTime = new RegExp( sVDTime, "i");

	if (reVDTime.test( Elem.value))
	{
		var sTokArr = Elem.value.match( reVDTime);

		if (nDateLen > 0)
		{
			if (sTokArr[2] == "" || sTokArr[2] == null)
				Elem.value = "  /  /  ";
			else
				Elem.value = sTokArr[2] + "/" + sTokArr[3] + "/" + sTokArr[4];
		}
		else
			Elem.value = "";

		if (nTimeLen > 0)
		{
			if (nDateLen > 0)
				Elem.value = Elem.value + " ";

			if (sTokArr[6] == "" || sTokArr[6] == null)
					Elem.value = Elem.value + "00";
			else
				Elem.value = Elem.value + sTokArr[6];

			if (nTimeLen > 2)
			{
				if (sTokArr[8] == "" || sTokArr[8] == null)
					Elem.value = Elem.value + ":00";
				else
					Elem.value = Elem.value + ":" + sTokArr[8];
			}

			if (nTimeLen > 5)
			{
				if (sTokArr[10] == "" || sTokArr[10] == null)
					Elem.value = Elem.value + ":00";
				else
					Elem.value = Elem.value + ":" + sTokArr[10];
			}

			if ( nTimeFmt == 1)
			{
				var x;
				if (sTokArr[11] == "" || sTokArr[11] == null)
					x = "a";
				else
					x = sTokArr[11].substr(0,1);
				if (x.toLowerCase() == "p")
				{
					Elem.value = Elem.value + " PM";
				}
				else
				{
					Elem.value = Elem.value + " AM";
				}
			}
		}
		return true;
	}
	GXAlert( Elem, message_text( sIdiom, "datefmt"));
	return false;
}
